﻿$(document).ready(function () {
    // create the loading window and set autoOpen to false
    $("#loadingScreen").dialog({
        autoOpen: false, // set this to false so we can manually open it
        dialogClass: "loadingScreenWindow",
        closeOnEscape: false,
        draggable: false,
        width: 100,
        minHeight: 80,
        modal: true,
        buttons: {},
        resizable: false,
        position: [350, 100],
        open: function () {
            // scrollbar fix for IE
            $('body').css('overflow', 'hidden');
        },
        close: function () {
            // reset overflow
            $('body').css('overflow', 'auto');
        }
    }); // end of dialog
    var helper = new Helper();
    
    helper.GetCurrentUserDetail(function (data) {
        $('#userNameShow').html(data.User);
        $('#SpanUserIP').html(data.IP);
        $('#SpanRoleShow').html(data.Role);
    });

});
function waitingDialog(waiting) { 
	$("#loadingScreen").html(waiting.message + '' != waiting.message ? waiting.message : 'Please wait...');
	$("#loadingScreen").dialog('option', 'title', waiting.title + '' != waiting.title ? waiting.title : 'Loading');
	$("#loadingScreen").dialog('open');
	var top = ($(window).height() - 80) / 2;
	var left = ($(window).width() - 100) / 2;

	$(".loadingScreenWindow").css('left', left);
	$(".loadingScreenWindow").css('top', top);
}
function closeWaitingDialog() {
	$("#loadingScreen").dialog('close');
}
function TimeStampToDate(xmlDate, isRemoveT) {
    if (xmlDate === null || xmlDate === '') {
        return null;
    }
    var xdate = xmlDate.replace(/-/g, "/");
    if (xdate.indexOf('.') > 0) {
        xdate = xdate.substring(0, xdate.indexOf('.'));
    }
    xdate = xdate.replace("T", " ");
    
    //var d = new Date('2011/12/30 04:52:15');
    var date = new Date(xdate);
    //var date = new Date(millisecsSince1970);
    return date;
}